package com.example.wangning.mycarofcountry.login;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by dllo on 16/1/20.
 */
public class LoginViewPagerAdapter extends FragmentPagerAdapter{
    private ArrayList<Fragment> data;
    String[] titles = {"登录","注册"};
    private Context context;
    public LoginViewPagerAdapter(FragmentManager fm,Context context) {
        super(fm);
        this.context = context;
        data = new ArrayList<>();
        data.add(new LoginFragment());
        data.add(new RegisterFragment());
    }

    @Override
    public Fragment getItem(int position) {
        return data.get(position);
    }

    @Override
    public int getCount() {
        return data.size() > 0 && data != null ? data.size() : 0;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
